<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>EasyNode - EasyNode API参考文档</title>
    <link rel="stylesheet" href="http://yui.yahooapis.com/3.9.1/build/cssgrids/cssgrids-min.css">
    <link rel="stylesheet" href="../assets/vendor/prettify/prettify-min.css">
    <link rel="stylesheet" href="../assets/css/main.css" id="site_styles">
    <link rel="icon" href="../assets/favicon.ico">
    <script src="http://yui.yahooapis.com/combo?3.9.1/build/yui/yui-min.js"></script>
</head>
<body class="yui3-skin-sam">

<div id="doc">
    <div id="hd" class="yui3-g header">
        <div class="yui3-u-3-4">
                <h1><img src="../assets/css/logo.png" title="EasyNode API参考文档" width="117" height="52"></h1>
        </div>
        <div class="yui3-u-1-4 version">
            <em>API Docs for: EasyNode - 0.1.0</em>
        </div>
    </div>
    <div id="bd" class="yui3-g">

        <div class="yui3-u-1-4">
            <div id="docs-sidebar" class="sidebar apidocs">
                <div id="api-list">
                    <h2 class="off-left">APIs</h2>
                    <div id="api-tabview" class="tabview">
                        <ul class="tabs">
                            <li><a href="#api-classes">Classes</a></li>
                            <li><a href="#api-modules">Modules</a></li>
                        </ul>
                
                        <div id="api-tabview-filter">
                            <input type="search" id="api-filter" placeholder="Type to filter APIs">
                        </div>
                
                        <div id="api-tabview-panel">
                            <ul id="api-classes" class="apis classes">
                                <li><a href="../classes/EasyNode.html">EasyNode</a></li>
                                <li><a href="../classes/easynode.framework.aop.AOP.html">easynode.framework.aop.AOP</a></li>
                                <li><a href="../classes/easynode.framework.BeanFactory.html">easynode.framework.BeanFactory</a></li>
                                <li><a href="../classes/easynode.framework.cache.CacheStat.html">easynode.framework.cache.CacheStat</a></li>
                                <li><a href="../classes/easynode.framework.cache.ICache.html">easynode.framework.cache.ICache</a></li>
                                <li><a href="../classes/easynode.framework.cache.Memcached.html">easynode.framework.cache.Memcached</a></li>
                                <li><a href="../classes/easynode.framework.cache.Redis.html">easynode.framework.cache.Redis</a></li>
                                <li><a href="../classes/easynode.framework.db.IConnection.html">easynode.framework.db.IConnection</a></li>
                                <li><a href="../classes/easynode.framework.db.IDataSource.html">easynode.framework.db.IDataSource</a></li>
                                <li><a href="../classes/easynode.framework.db.MysqlConnection.html">easynode.framework.db.MysqlConnection</a></li>
                                <li><a href="../classes/easynode.framework.db.MysqlDataSource.html">easynode.framework.db.MysqlDataSource</a></li>
                                <li><a href="../classes/easynode.framework.Logger.html">easynode.framework.Logger</a></li>
                                <li><a href="../classes/easynode.framework.mq.IQueue.html">easynode.framework.mq.IQueue</a></li>
                                <li><a href="../classes/easynode.framework.mq.RedisListQueue.html">easynode.framework.mq.RedisListQueue</a></li>
                                <li><a href="../classes/easynode.framework.mq.RedisQueue.html">easynode.framework.mq.RedisQueue</a></li>
                                <li><a href="../classes/easynode.framework.mvc.Action.html">easynode.framework.mvc.Action</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionArgConverter.html">easynode.framework.mvc.ActionArgConverter</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionContext.html">easynode.framework.mvc.ActionContext</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionExecutor.html">easynode.framework.mvc.ActionExecutor</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionFactory.html">easynode.framework.mvc.ActionFactory</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionRequestParameter.html">easynode.framework.mvc.ActionRequestParameter</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ActionResult.html">easynode.framework.mvc.ActionResult</a></li>
                                <li><a href="../classes/easynode.framework.mvc.CombinedAction.html">easynode.framework.mvc.CombinedAction</a></li>
                                <li><a href="../classes/easynode.framework.mvc.EJSTemplateViewRenderer.html">easynode.framework.mvc.EJSTemplateViewRenderer</a></li>
                                <li><a href="../classes/easynode.framework.mvc.IActionContextListener.html">easynode.framework.mvc.IActionContextListener</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ITemplateViewRenderer.html">easynode.framework.mvc.ITemplateViewRenderer</a></li>
                                <li><a href="../classes/easynode.framework.mvc.JadeTemplateViewRenderer.html">easynode.framework.mvc.JadeTemplateViewRenderer</a></li>
                                <li><a href="../classes/easynode.framework.mvc.JSONView.html">easynode.framework.mvc.JSONView</a></li>
                                <li><a href="../classes/easynode.framework.mvc.MethodDispatchedAction.html">easynode.framework.mvc.MethodDispatchedAction</a></li>
                                <li><a href="../classes/easynode.framework.mvc.Model.html">easynode.framework.mvc.Model</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ModelField.html">easynode.framework.mvc.ModelField</a></li>
                                <li><a href="../classes/easynode.framework.mvc.ModelProxyActionFactory.html">easynode.framework.mvc.ModelProxyActionFactory</a></li>
                                <li><a href="../classes/easynode.framework.mvc.MustacheTemplateViewRenderer.html">easynode.framework.mvc.MustacheTemplateViewRenderer</a></li>
                                <li><a href="../classes/easynode.framework.mvc.spi.MysqlModelGenerator.html">easynode.framework.mvc.spi.MysqlModelGenerator</a></li>
                                <li><a href="../classes/easynode.framework.mvc.View.html">easynode.framework.mvc.View</a></li>
                                <li><a href="../classes/easynode.framework.plugin.EasyNodePlugin.html">easynode.framework.plugin.EasyNodePlugin</a></li>
                                <li><a href="../classes/easynode.framework.plugin.PluginLoadContext.html">easynode.framework.plugin.PluginLoadContext</a></li>
                                <li><a href="../classes/easynode.framework.queue.MQTTQueue.html">easynode.framework.queue.MQTTQueue</a></li>
                                <li><a href="../classes/easynode.framework.server.AbstractServer.html">easynode.framework.server.AbstractServer</a></li>
                                <li><a href="../classes/easynode.framework.server.http.KOAActionContext.html">easynode.framework.server.http.KOAActionContext</a></li>
                                <li><a href="../classes/easynode.framework.server.http.KOADefaultRoutes.html">easynode.framework.server.http.KOADefaultRoutes</a></li>
                                <li><a href="../classes/easynode.framework.server.http.KOAHttpRequestParameter.html">easynode.framework.server.http.KOAHttpRequestParameter</a></li>
                                <li><a href="../classes/easynode.framework.server.http.KOAHttpServer.html">easynode.framework.server.http.KOAHttpServer</a></li>
                                <li><a href="../classes/easynode.framework.server.http.KOAHttpServer.SessionSupport.html">easynode.framework.server.http.KOAHttpServer.SessionSupport</a></li>
                                <li><a href="../classes/easynode.framework.server.KOAMemorySessionStorage.html">easynode.framework.server.KOAMemorySessionStorage</a></li>
                                <li><a href="../classes/easynode.framework.server.ServerStat.html">easynode.framework.server.ServerStat</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.Decoder.html">easynode.framework.server.tcp.Decoder</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.Encoder.html">easynode.framework.server.tcp.Encoder</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.Message.html">easynode.framework.server.tcp.Message</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.MessageHandler.html">easynode.framework.server.tcp.MessageHandler</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.protocols.JSONDecoder.html">easynode.framework.server.tcp.protocols.JSONDecoder</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.protocols.JSONEncoder.html">easynode.framework.server.tcp.protocols.JSONEncoder</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.protocols.JSONMessageHandler.html">easynode.framework.server.tcp.protocols.JSONMessageHandler</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.StreamDecoderHelper.html">easynode.framework.server.tcp.StreamDecoderHelper</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.StreamEncoderHelper.html">easynode.framework.server.tcp.StreamEncoderHelper</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.TCPClient.html">easynode.framework.server.tcp.TCPClient</a></li>
                                <li><a href="../classes/easynode.framework.server.tcp.TCPServer.html">easynode.framework.server.tcp.TCPServer</a></li>
                                <li><a href="../classes/easynode.framework.test.TestCase.html">easynode.framework.test.TestCase</a></li>
                                <li><a href="../classes/easynode.framework.test.TestCaseRunner.html">easynode.framework.test.TestCaseRunner</a></li>
                                <li><a href="../classes/easynode.framework.util..StringUtil.html">easynode.framework.util..StringUtil</a></li>
                                <li><a href="../classes/easynode.framework.util.Binary.html">easynode.framework.util.Binary</a></li>
                                <li><a href="../classes/easynode.framework.util.HTTPUtil.html">easynode.framework.util.HTTPUtil</a></li>
                                <li><a href="../classes/easynode.framework.util.MustacheHelper.html">easynode.framework.util.MustacheHelper</a></li>
                                <li><a href="../classes/easynode.framework.util.ObjectWrapper.html">easynode.framework.util.ObjectWrapper</a></li>
                                <li><a href="../classes/easynode.framework.util.SqlUtil.html">easynode.framework.util.SqlUtil</a></li>
                                <li><a href="../classes/easynode.framework.util.VersionComparator.html">easynode.framework.util.VersionComparator</a></li>
                                <li><a href="../classes/easynode.framework.view.TemplateView.html">easynode.framework.view.TemplateView</a></li>
                                <li><a href="../classes/easynode.GenericObject.html">easynode.GenericObject</a></li>
                                <li><a href="../classes/全局函数.html">全局函数</a></li>
                            </ul>
                
                            <ul id="api-modules" class="apis modules">
                            </ul>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="yui3-u-3-4">
                <div id="api-options">
                    Show:
                    <label for="api-show-inherited">
                        <input type="checkbox" id="api-show-inherited" checked>
                        Inherited
                    </label>
            
                    <label for="api-show-protected">
                        <input type="checkbox" id="api-show-protected">
                        Protected
                    </label>
            
                    <label for="api-show-private">
                        <input type="checkbox" id="api-show-private">
                        Private
                    </label>
                    <label for="api-show-deprecated">
                        <input type="checkbox" id="api-show-deprecated">
                        Deprecated
                    </label>
            
                </div>
            
            <div class="apidocs">
                <div id="docs-main">
                    <div class="content">
<h1>EasyNode Class</h1>
<div class="box meta">


        <div class="foundat">
            Defined in: <a href="../files/.._src_EasyNode.js.html#l10"><code>..&#x2F;src&#x2F;EasyNode.js:10</code></a>
        </div>


</div>


<div class="box intro">
    <p>为简化API调用定义必要的全局函数，使用全局函数需要引入EasyNode.js，请在应用程序第一行引入EasyNode.js。<br>
<h5>示例</h5>
<a href="//bin/main.js%E3%80%82%E7%AC%AC%E4%B8%80%E8%A1%8C">//bin/main.js。第一行</a><br>
require('../src/EasyNode.js');<br>
EasyNode.addSourceDirectory('test', 'demo','app');<br>
EasyNode.addConfigFile('app.conf');<br>
var Logger = using('easynode.framework.Logger');<br>
Logger.getLogger().info('Hello, EasyNode');<br></p>

</div>


<div id="classdocs" class="tabview">
    <ul class="api-class-tabs">
        <li class="api-class-tab index"><a href="#index">Index</a></li>

            <li class="api-class-tab methods"><a href="#methods">Methods</a></li>
    </ul>

    <div>
        <div id="index" class="api-class-tabpanel index">
            <h2 class="off-left">Item Index</h2>

                <div class="index-section methods">
                    <h3>Methods</h3>

                    <ul class="index-list methods">
                            <li class="index-item method private">
                                <a href="#method__getNamespace">_getNamespace</a>

                            </li>
                            <li class="index-item method private">
                                <a href="#method__initNamespaces">_initNamespaces</a>

                            </li>
                            <li class="index-item method private">
                                <a href="#method__trim">_trim</a>

                            </li>
                            <li class="index-item method">
                                <a href="#method_addConfigFile">addConfigFile</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_addSourceDirectory">addSourceDirectory</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_arg">arg</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_config">config</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_create">create</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_EasyNode.real">EasyNode.real</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_extend">extend</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getLocale">getLocale</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_getLocalIP">getLocalIP</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_home">home</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_i18n">i18n</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_namespace">namespace</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_namespace2Path">namespace2Path</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_setLocale">setLocale</a>

                                    <span class="flag static">static</span>
                            </li>
                            <li class="index-item method">
                                <a href="#method_using">using</a>

                                    <span class="flag static">static</span>
                            </li>
                    </ul>
                </div>



        </div>

            <div id="methods" class="api-class-tabpanel">
                <h2 class="off-left">Methods</h2>

<div id="method__getNamespace" class="method item private">
    <h3 class="name"><code>_getNamespace</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type">Namespace</span>
        </span>


        <span class="flag private">private</span>





    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l25"><code>..&#x2F;src&#x2F;EasyNode.js:25</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>返回指定名称的namespace，使用JSON对象来模拟namespace。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>namespace字符串</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type">Namespace</span>:
                    <p>JSON模拟的namespace对象</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> var ns = _getNamespace('easynode.framework.Logger');                 //返回对象easynode.framework</code></pre>
<pre class="code prettyprint"><code> var ns = _getNamespace('easynode.framework.*');                          //返回对象easynode.framework</code></pre>

            </div>
        </div>
</div>
<div id="method__initNamespaces" class="method item private">
    <h3 class="name"><code>_initNamespaces</code></h3>

        <span class="paren">()</span>



        <span class="flag private">private</span>





    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l51"><code>..&#x2F;src&#x2F;EasyNode.js:51</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>初始化命名空间，using时自动调用。</p>

    </div>




        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> require('../src/EasyNode.js');
 EasyNode.addSourceDirectory('test', 'demo');                 // $EasyNode/test/,  $EasyNode/demo
 EasyNode.using('easynode.framework.Logger');</code></pre>

            </div>
        </div>
</div>
<div id="method__trim" class="method item private">
    <h3 class="name"><code>_trim</code></h3>

        <span class="paren">()</span>



        <span class="flag private">private</span>





    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l102"><code>..&#x2F;src&#x2F;EasyNode.js:102</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>字符串去两端空格。</p>

    </div>




        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> console.log(_trim('   abc   '));                        //print : 'abc'</code></pre>

            </div>
        </div>
</div>
<div id="method_addConfigFile" class="method item">
    <h3 class="name"><code>addConfigFile</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code></code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l206"><code>..&#x2F;src&#x2F;EasyNode.js:206</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>向EasyNode添加配置文件。配置文件需要位于$EasyNode/etc/目录，默认的配置文件为：EasyNode.conf。该文件始终在所有的配置文件生效前被加载 。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name"></code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>

                        <span class="flag multiple" title="This argument may occur one or more times.">multiple</span>

                    <div class="param-description">
                        <p>配置文件名，可一次添加多个文件。</p>

                    </div>

                </li>
            </ul>
        </div>


        <div class="throws">
            <h4>Throws:</h4>

            <div class="throws-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error" class="crosslink external" target="_blank">Error</a></span>:
                    <p>配置文件不存在。{TypeError} 参数非String类型。</p>

            </div>
        </div>

        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> require('../src/EasyNode.js');
 EasyNode.addConfigFile('app.conf', 'app1.conf', 'app2.conf');            // etc/app.conf, etc/app1.conf, etc/app2.conf
 EasyNode.console.log(config('easynode.app.name'));</code></pre>

            </div>
        </div>
</div>
<div id="method_addSourceDirectory" class="method item">
    <h3 class="name"><code>addSourceDirectory</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code></code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l587"><code>..&#x2F;src&#x2F;EasyNode.js:587</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>向EasyNode添加一个源码目录，使用using引用一个类、对象或命名空间时，EasyNode在所有的源码目录下查找同
名的目录或js文件，默认的源码目录为：$EasyNode/src/。</p>
<h5>注意：为了识别不同目录下的命名空间，源码目录必须以'src'结尾的目录</h5>
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name"></code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>

                        <span class="flag multiple" title="This argument may occur one or more times.">multiple</span>

                    <div class="param-description">
                        <p>源码目录，相对于EasyNode根目录。可一次添加多个源码目录。</p>

                    </div>

                </li>
            </ul>
        </div>


        <div class="throws">
            <h4>Throws:</h4>

            <div class="throws-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error" class="crosslink external" target="_blank">Error</a></span>:
                    <p>源码目录不存在。{TypeError} 参数非String类型。</p>

            </div>
        </div>

        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> require('../src/EasyNode.js');
 EasyNode.addSourceDirectory('test', 'demo');                 // $EasyNode/test/,  $EasyNode/demo</code></pre>

            </div>
        </div>
</div>
<div id="method_arg" class="method item">
    <h3 class="name"><code>arg</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l170"><code>..&#x2F;src&#x2F;EasyNode.js:170</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取命令行参数。一个命令行参数需要定义在入口js文件之后，并且格式为--$key=$value。<br>
babel-node main.js --easynode.app.name=MyApp</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>配置项key。</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>配置值。</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> 命令行参数：babel-node main.js --easynode.app.name=YourApp
 console.log(config('easynode.app.name'));                  //print : 'YourApp'</code></pre>

            </div>
        </div>
</div>
<div id="method_config" class="method item">
    <h3 class="name"><code>config</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l242"><code>..&#x2F;src&#x2F;EasyNode.js:242</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取配置文件中的配置参数。配置参数默认为etc/EasyNode.conf，可以通过EasyNode.addConfigFile向EasyNode添加配置文件。<br>
注意：如果命令行参数与配置项具有相同的key，则返回命令行参数值。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>配置项key。</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>配置值。如果不传递任何参数，EasyNode则会加载配置文件，但不会返回任何值。</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> 配置文件：etc/EasyNode.conf  ==&gt; easynode.app.name = MyApp
 console.log(config('easynode.app.name'));                  //print : 'MyApp'

 命令行参数：babel-node main.js --easynode.app.name=YourApp
 console.log(EasyNode.config('easynode.app.name'));                  //print : 'YourApp'</code></pre>

            </div>
        </div>
</div>
<div id="method_create" class="method item">
    <h3 class="name"><code>create</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>namespace</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l628"><code>..&#x2F;src&#x2F;EasyNode.js:628</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>创建一个实例，指定的namespace必须是一个全类名。即：Node.js的导出对象是一个类，或者是ES5的函数。</p>
<h5>注意，该类必须能够通过无参构造器实例化。</h5>
    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">namespace</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>全类名</p>

                    </div>

                </li>
            </ul>
        </div>



        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> require('../src/EasyNode.js');
 var plugin = EasyNode.create('easynode.framework.plugin.EasyNodePlugin');
 console.log(plugin.toJSON());</code></pre>

            </div>
        </div>
</div>
<div id="method_EasyNode.real" class="method item">
    <h3 class="name"><code>EasyNode.real</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>p</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l137"><code>..&#x2F;src&#x2F;EasyNode.js:137</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>相对路径转绝对路径。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">p</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>相对路径</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>绝对路径</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> var path = 'src/EasyNode.js';
 console.log(EasyNode.real(path));                //print : /home/zlbbq/EasyNode/src/EasyNode.js</code></pre>

            </div>
        </div>
</div>
<div id="method_extend" class="method item">
    <h3 class="name"><code>extend</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>JSON对象</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l154"><code>..&#x2F;src&#x2F;EasyNode.js:154</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>JSON对象扩展，这个函数是underscore的extend函数的快捷方式，具体使用请参考underscore.extend()函数。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">JSON对象</code>
                        <span class="type">...</span>


                    <div class="param-description">
                         
                    </div>

                </li>
            </ul>
        </div>



        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> var o = { a : 'a' };
 extend(o, { b : 'b'});          // o = { a : 'a', b : 'b'}</code></pre>

            </div>
        </div>
</div>
<div id="method_getLocale" class="method item">
    <h3 class="name"><code>getLocale</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>locale</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l375"><code>..&#x2F;src&#x2F;EasyNode.js:375</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取i18n Locale，系统默认'zh_CN'</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">locale</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>地区字符串。</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_getLocalIP" class="method item">
    <h3 class="name"><code>getLocalIP</code></h3>

        <span class="paren">()</span>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l647"><code>..&#x2F;src&#x2F;EasyNode.js:647</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取本机第一块以ethx命名的网卡的配置的第一个IP地址。</p>

    </div>


        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>本地IP地址</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> require('../src/EasyNode.js');
 var plugin = EasyNode.create('easynode.framework.plugin.EasyNodePlugin');
 console.log(plugin.toJSON());</code></pre>

            </div>
        </div>
</div>
<div id="method_home" class="method item">
    <h3 class="name"><code>home</code></h3>

        <span class="paren">()</span>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l120"><code>..&#x2F;src&#x2F;EasyNode.js:120</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取EasyNode的根目录。默认返回进程当前目录的父目录，因此需要在bin目录下启用nodejs；如果传递了命令行参数easynode-home，则返回该命令
行参数指定的路径。</p>

    </div>


        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>EasyNode根目录的绝对路径。</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> //在bin目录下启动：babel-node ./main.js
 console.log(EasyNode.home());                                            //print：/home/zlbbq/EasyNode</code></pre>

            </div>
        </div>
</div>
<div id="method_i18n" class="method item">
    <h3 class="name"><code>i18n</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code>prefix</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l295"><code>..&#x2F;src&#x2F;EasyNode.js:295</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取字符串表，国际化支持。配置文件：etc/i18n_$locale.conf，格式与EasyNode.conf相同。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>国际化字符串配置项key。</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">prefix</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>如果传递此值，请始终传递__filename，__filename会被转成namespace(file) + '.' + name;</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>配置值。如果不传递任何参数，EasyNode则会加载国际化配置文件，但不会返回任何值。</p>

            </div>
        </div>


</div>
<div id="method_namespace" class="method item">
    <h3 class="name"><code>namespace</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l388"><code>..&#x2F;src&#x2F;EasyNode.js:388</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取文件的命名空间名称或全类名。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>建议在源码文件中使用__filename或__dirname。</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>:
                    <p>命名空间名称或全类名。</p>

            </div>
        </div>

        <div class="throws">
            <h4>Throws:</h4>

            <div class="throws-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error" class="crosslink external" target="_blank">Error</a></span>:
                    <p>源码文件不在src目录中。</p>

            </div>
        </div>

        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> //文件：src/easynode.framework.Logger.js
 console.log(EasyNode.namespace(__filename));             //print : easynode.framework.Logger
 console.log(EasyNode.namespace(__dirname));              //print : easynode.framework</code></pre>

            </div>
        </div>
</div>
<div id="method_namespace2Path" class="method item">
    <h3 class="name"><code>namespace2Path</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>namespace</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>


        <span class="flag async">async</span>

    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l532"><code>..&#x2F;src&#x2F;EasyNode.js:532</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>获取指定命名空间或全类名的绝对路径。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">namespace</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>命名空间或全类名。easynode.GenericObject</p>

                    </div>

                </li>
            </ul>
        </div>


        <div class="throws">
            <h4>Throws:</h4>

            <div class="throws-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error" class="crosslink external" target="_blank">Error</a></span>:
                    <p>源码目录不存在。{TypeError} 参数非String类型。</p>

            </div>
        </div>

</div>
<div id="method_setLocale" class="method item">
    <h3 class="name"><code>setLocale</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>locale</code>
                </li>
            </ul><span class="paren">)</span>
        </div>





        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l362"><code>..&#x2F;src&#x2F;EasyNode.js:362</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>设置i18n Locale，系统默认'zh_CN'，i18n默认读取的配置文件为etc/i18n/$locale.conf，如：etc/i18n/zh_CN.conf。
在使用i18n函数前调用此函数才能正确设置语言。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">locale</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>地区字符串。</p>

                    </div>

                </li>
            </ul>
        </div>



</div>
<div id="method_using" class="method item">
    <h3 class="name"><code>using</code></h3>

        <div class="args">
            <span class="paren">(</span><ul class="args-list inline commas">
                <li class="arg">
                        <code>name</code>
                </li>
                <li class="arg">
                        <code>throwError</code>
                </li>
            </ul><span class="paren">)</span>
        </div>

        <span class="returns-inline">
            <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>
        </span>




        <span class="flag static">static</span>



    <div class="meta">
                <p>
                Defined in
        <a href="../files/.._src_EasyNode.js.html#l412"><code>..&#x2F;src&#x2F;EasyNode.js:412</code></a>
        </p>



            <p>Available since 0.1.0</p>
    </div>

    <div class="description">
        <p>引用一个类、模块或者一个命名空间下所有的类或模块，取决于Node.js的导出。</p>

    </div>

        <div class="params">
            <h4>Parameters:</h4>

            <ul class="params-list">
                <li class="param">
                        <code class="param-name">name</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/String" class="crosslink external" target="_blank">String</a></span>


                    <div class="param-description">
                        <p>全类名或命名空间名。</p>

                    </div>

                </li>
                <li class="param">
                        <code class="param-name">throwError</code>
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Boolean" class="crosslink external" target="_blank">Boolean</a></span>


                    <div class="param-description">
                        <p>是否在类或命名空间未找到时抛出异常，默认为true，当throwError为false时，如果没有找到相应的类或命名空间则返回null</p>

                    </div>

                </li>
            </ul>
        </div>

        <div class="returns">
            <h4>Returns:</h4>

            <div class="returns-description">
                        <span class="type"><a href="https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object" class="crosslink external" target="_blank">Object</a></span>:
                    <p>类，对象，或命名空间对象。</p>

            </div>
        </div>


        <div class="example">
            <h4>Example:</h4>

            <div class="example-content">
                <pre class="code prettyprint"><code> //引用一个类
 EasyNode.using('easynode.framework.Logger');

 //引用easynode.framework命名空间下所有的类。
 EasyNode.using('easynode.framework.*');</code></pre>
<pre class="code prettyprint"><code> var Logger = EasyNode.using('easynode.framework.Logger');
 Logger.getLogger().info('Hello, EasyNode');</code></pre>
<pre class="code prettyprint"><code> EasyNode.using('easynode.framework.Logger');
 easynode.framework.Logger.getLogger().info('Hello, EasyNode');</code></pre>
<pre class="code prettyprint"><code> var ns = using('easynode.framework.*');
 ns.Logger.getLogger().info('Hello, EasyNode');</code></pre>

            </div>
        </div>
</div>
            </div>



    </div>
</div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="../assets/vendor/prettify/prettify-min.js"></script>
<script>prettyPrint();</script>
<script src="../assets/js/yui-prettify.js"></script>
<script src="../assets/../api.js"></script>
<script src="../assets/js/api-filter.js"></script>
<script src="../assets/js/api-list.js"></script>
<script src="../assets/js/api-search.js"></script>
<script src="../assets/js/apidocs.js"></script>
</body>
</html>
